package com.flashdeck.utils;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;

import org.apache.commons.io.IOUtils;

import junit.framework.TestCase;

public class InputStreamLimitTest extends TestCase {

	public void testInputStream() throws IOException {
		String text = "Labas kaip sekas ?";
		InputStream mainInputStream = new ByteArrayInputStream(text.getBytes());
		int limit = 10;
		InputStreamLimit inputStreamLimit = new InputStreamLimit(mainInputStream, limit);
		String result = IOUtils.toString(inputStreamLimit);
		assertEquals(text.substring(0, limit), result);
	}
}
